/*
 * 2005-11-12 lxm 创建。 
 */
package com.hd123.rumba.runtime;

import java.text.ParseException;

import net.sf.hibernate.HibernateException;

import com.hd123.rumba.domain.DDomain;
import com.hd123.rumba.domain.IDomain;
import com.hd123.rumba.exception.BusinessException;

/**
 * @author lxm
 * 
 * 对应IBaseEntity的数据交换对象
 */
public class DBaseEntity extends DVersionedPersistent {

  private String domainUuid;
  private String lastModifier;
  private String state;

  // /////////////////////////
  // 用于 Web Service 数据交换

  /**
   * 从指定的接口对象赋值。
   * 
   * @param source
   */
  public void assignFrom(IPersistent source) {
    super.assignFrom(source);
    if (source instanceof IBaseEntity) {
      this.domainUuid = exportString(source, new String[] {"getDomain", "getUuid"});
      this.lastModifier = exportString(source, "getLastModifier");
      this.state = exportInteger(source, "getState");
    }
  }

  /**
   * 将数据赋值给指定的接口对象。
   * 
   * @param source
   */
  public void assignTo(IPersistent target) throws ParseException, BusinessException, HibernateException {
    super.assignTo(target);
    if (target instanceof IBaseEntity) {
      importObject(target, "setDomain", DDomain.importDomain(this.domainUuid), IDomain.class);
      importString(target, "setLastModifier", this.lastModifier);
      importInteger(target, "setState", this.state);
    }
  }

  // /////////////////////////
  // 属性方法

  public String getDomainUuid() {
    return domainUuid;
  }

  public void setDomainUuid(String domainUuid) {
    this.domainUuid = domainUuid;
  }

  public String getLastModifier() {
    return lastModifier;
  }

  public void setLastModifier(String lastModifier) {
    this.lastModifier = lastModifier;
  }

  public String getState() {
    return state;
  }

  public void setState(String state) {
    this.state = state;
  }

}
